<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      >

    <body>

        <ui:composition template="./resources/mastersPages/MasterPage.xhtml">

            <ui:define name="content">
                <h:form>
                    <nav class="navbar navbar-default" role="navigation">
                        <ul class="nav navbar-nav">
                            <li class=""><a href="CadastrarAcao.xhtml"><i class="glyphicon glyphicon-plus"></i>  Nova Ação</a></li>
                        </ul>
                    </nav>

                </h:form>
                <h:form>

                    <fieldset>

                        <legend><i class="glyphicon glyphicon-th-list" ></i> Listagem</legend>
                        <h:dataTable var="acao" value="#{acaoMB.acoes}" class="table table-bordered table-hover">
                            <h:column>
                                <f:facet name="header">
                                    <h:commandLink value="ID" class="glyphicon glyphicon-sort"/>
                                </f:facet>
                                #{acao.idAcao}                    
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    Nome Ação
                                </f:facet>
                                #{acao.nome}                    
                            </h:column>                
                            <h:column>
                                <f:facet name="header">
                                    Descrição
                                </f:facet>
                                #{acao.descricao}                    
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    Status
                                </f:facet>
                                #{acao.statusString}   

                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    Ações
                                </f:facet>
                                <h:commandLink action="#{acaoMB.editar(acao)}" >
                                    <i class="glyphicon glyphicon-edit"></i>
                                </h:commandLink>


                                <h:commandLink action="#{acaoMB.excluir(acao)}" onclick="return confirm('Deseja realmente excluir?')">
                                    <i class="glyphicon glyphicon-trash"></i>
                                </h:commandLink>                                          
                            </h:column>
                        </h:dataTable>
                    </fieldset>
                </h:form>

                <h:form>

                    <h:commandLink action="Dashobord.xhtml" class="btn btn-link">Voltar</h:commandLink>

                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
